package com.fanqwz.hexieshe.data.common;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

/**
 * Created by fanqw on 2017/7/5.
 */

public class Utils {

    public static String webContentImageScaleToFitScreen(String content) {
        Document doc= Jsoup.parse(content);
        Elements elements=doc.getElementsByTag("img");
        for (Element element : elements) {
            element.attr("width","100%").attr("height","auto");
        }

        elements=doc.getElementsByTag("iframe");
        for (Element element : elements) {
            element.attr("width","100%").attr("height","auto");
        }

        return doc.toString();
    }
}
